from os import path, environ, system
if __name__ == '__main__':
    try:
        import PySide6
    except ModuleNotFoundError:
        lib = 'PySide6'
        choice = input(f'本程序需要安装{lib}才能运行，是否安装{lib}？(Y/n)：').upper()
        if choice == 'Y':
            system(f'pip install {lib} -i https://pypi.tuna.tsinghua.edu.cn/simple')
            import PySide6
        else:
            exit(1)
    dirname = path.dirname(PySide6.__file__)
    plugin_path = path.join(dirname, 'plugins', 'platforms')
    environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path

"""
逃离灰太狼的追捕
一个小游戏
Python PySide6编写
作者：Carburn Ashroom
"""

from PySide6.QtWidgets import QApplication
from MainWindow import MainWindow

if __name__ == '__main__':
    app = QApplication()
    w = MainWindow()
    w.show()
    exit(app.exec())
